/* --------------------------------------------------------
 * Copyright (c) aeky , Inc.  All rights reserved.
 * --------------------------------------------------------
 */
package com.aeky.client.view.welcome;

import com.aeky.client.common.DemoConstants;
import com.aeky.client.common.Registry;
import com.aeky.client.view.base.AekyWidget;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.Layout;
import com.smartgwt.client.widgets.layout.VLayout;

/**
 * @author aeky
 */
public class MainPanel extends AekyWidget {

    /** 主模板 */
    private HLayout mainPanel;

    /** 西边Panel */
    private Layout westPanel;

    /** 中心Panel */
    private VLayout centerPanel;

    private HLayout centerHeadPanel;

    private Layout centerBodyPanel;

    public MainPanel() {
        instanceWidgets();
        mainPanel.addMember(westPanel);
        mainPanel.addMember(centerPanel);
        Registry.registry(DemoConstants.WEST_PANEL, westPanel);
        Registry.registry(DemoConstants.CENTER_HEAD_PANEL, centerHeadPanel);
        Registry.registry(DemoConstants.CENTER_BODY_PANEL, centerBodyPanel);
        this.setShowEdges(true);
        this.setEdgeSize(1);
        this.addMember(mainPanel);
    }

    private void instanceWidgets() {
        mainPanel = new HLayout();
        mainPanel.setWidth100();
        mainPanel.setHeight100();
        westPanel = new Layout();
        westPanel.setHeight100();
        westPanel.setWidth("20%");
        westPanel.setShowResizeBar(true);
        centerPanel = new VLayout();
        centerPanel.setHeight100();
        centerPanel.setWidth("80%");
        centerHeadPanel = new HLayout();
        centerHeadPanel.setStyleName("centerHeadPanel");
        centerHeadPanel.setHeight(25);
        centerHeadPanel.setWidth100();
        centerBodyPanel = new Layout();
        centerBodyPanel.setHeight100();
        centerBodyPanel.setOverflow(Overflow.AUTO);
        centerPanel.addMember(centerHeadPanel);
        centerPanel.addMember(centerBodyPanel);
    }

    public Layout getWestPanel() {
        return westPanel;
    }

    public void setWestPanel(Layout westPanel) {
        this.westPanel = westPanel;
    }

    public Layout getCenterPanel() {
        return centerPanel;
    }

    public void setCenterPanel(VLayout centerPanel) {
        this.centerPanel = centerPanel;
    }

}
